#pragma once
#include "RedBlackTree.h"

namespace YX
{
	template<class K,class V>
	class map
	{
		typedef struct RedBlackTreeNode<pair<K, V>> Node;

		struct MapKeyOfType
		{
			const K& operator()(const pair<K, V>& kv)
			{
				return kv.first;
			}
		};

	private:	
		RedBlackTree<K,pair<K,V>,MapKeyOfType> _tree;
		
	public:

		typedef typename RedBlackTree<K, pair<K, V>, MapKeyOfType>::iterator iterator;

		pair<iterator, bool> Insert(const pair<K,V>& kv)
		{
			return _tree.Insert(kv);
		}

		iterator begin() const
		{
			return _tree.begin();
		}

		iterator end() const
		{
			return _tree.end();
		}

	};
}